﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class UserControls_WebUserControl : System.Web.UI.UserControl
{
    private CtrlRequerimientos ctrlFunctionalRequirement;

    public void setCtrlFunctionalRequirement(CtrlRequerimientos c)
    {

        ctrlFunctionalRequirement = c;
    
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        //setDataSource1(ctrlFunctionalRequirement.getData());
       // setDataSource2();
    }

   

    protected void GridView1_RowCommand(object source, GridViewCommandEventArgs e)
    {

            int index = Convert.ToInt32(e.CommandArgument);
            GridViewRow selectedRow = GridView1.Rows[index];
            GridView1.DeleteRow(index);
            DataTable d = GridView2.DataSource as DataTable;
            d.Rows.Add(selectedRow);
            GridView2.DataSource = d;
            GridView2.DataBind();
            ctrlFunctionalRequirement.addConflict(Int32.Parse(selectedRow.Cells[0].ToString()), selectedRow.Cells[2].ToString());
        
    }
    protected void GridView2_RowCommand(object source, GridViewCommandEventArgs e)
    {
            int index = Convert.ToInt32(e.CommandArgument);
            GridViewRow selectedRow = GridView2.Rows[index];
            GridView2.DeleteRow(index);
            DataTable d = GridView1.DataSource as DataTable;
            d.Rows.Add(selectedRow);
            GridView1.DataSource = d;
            GridView1.DataBind();
            ctrlFunctionalRequirement.deleteConflict(Int32.Parse(selectedRow.Cells[0].ToString()));
        
    }


    public void setDataSource1(DataSet dataSet1) {
        GridView1.DataSource = dataSet1;
        if (!IsPostBack)
        {
            GridView1.DataBind();
        }
    }

    public void setDataSource2(DataSet dataSet2)
    {
        GridView2.DataSource = dataSet2;
        if (!IsPostBack)
        {
            GridView2.DataBind();
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
